import frida
import sys


# Application(identifier="today.tophub.app", name="今日热榜", pid=15873, parameters={})
rdev = frida.get_remote_device()
# rdev = frida.get_usb_device()
session = rdev.attach("今日热榜")

scr = '''
Java.perform(function () {
    var k = Java.use('com.blankj.utilcode.util.k'); // 替换为实际的类路径
    k.i.implementation = function (str) {
        console.log('调用原始函数 authorization()，参数为str: ' + str);

        var result = this.i(str); // 调用原始函数
        console.log('i函数的返回值为: ' + result);
        console.log(Java.use("android.util.Log").getStackTraceString(Java.use("java.lang.Throwable").$new()));
        return result;
    };
});
'''

script = session.create_script(scr)


def on_message(message, data):
    print(message, data)


script.on("message", on_message)

script.load()
sys.stdin.read()


